package cn.qin.methodTest;

import static org.junit.Assert.*;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.Test;

import cn.qin.dao.marketDao;
import cn.qin.model.SPgoods;

public class methodTest {
	marketDao md = new marketDao();
	@Test
	public void addSp(){
		SPgoods goods = new SPgoods();
		SessionFactory sf = new AnnotationConfiguration().configure().buildSessionFactory();
		System.out.println("add");
		goods.setSPcategory("1");
		goods.setSPexp("1");
		goods.setSPid("1");
		goods.setSPimgs("1");
		goods.setSPinfo("1");
		goods.setSPmarket("1");
		goods.setSPmfrs("1");
		goods.setSPpdate("1");
		goods.setSPqty("1");
		goods.setSPspecs("1");
		Session session = sf.getCurrentSession();
		session.beginTransaction();
		session.save(goods);
		session.getTransaction().commit();
		sf.close();		
	}

}
